/*
 * MIT License
 *
 * Copyright (c) 2020 wen.gu <454727014@qq.com>
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in all
 * copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */

/***************************************************************************
 * Name: network_binding_skeleton.h
 *
 * Purpose: network binding component interface define for skeleton endain
 *
 * Developer:
 *   wen.gu , 2020-04-23
 *
 * TODO:
 *
 ***************************************************************************/

#ifndef __ARA_COM_RUNTIME_NETWORK_BINDING_SKELETON_H__
#define __ARA_COM_RUNTIME_NETWORK_BINDING_SKELETON_H__
/******************************************************************************
 **    INCLUDES
 ******************************************************************************/
#include <functional>

#include "ara/core/future.h"
#include "ara/com/runtime/deserializer.h"
#include "ara/com/runtime/serializer.h"

#include "ara/core/string.h"
#include "ara/com/runtime/message.h"
#include "ara/com/com_error_domain.h"
/******************************************************************************
 **    MACROS
 ******************************************************************************/


/******************************************************************************
 **    TYPE DEFINITIONS
 ******************************************************************************/
namespace ara
{
namespace com
{
namespace runtime
{
using NetworkBindingReceiveHandler = std::function<void(std::shared_ptr<Message>)> ;
/******************************************************************************
 **    CLASSES/FUNCTIONS DEFINITIONS
 ******************************************************************************/
class NetworkBindingSkeleton
{
    template<typename T>
    using Future = ara::core::Future<T>;

public:
    NetworkBindingSkeleton() = default;
    virtual ~NetworkBindingSkeleton() = default;

public:
    /**todo, define APIs for skeleton endain */
    virtual bool OfferService() = 0;
    virtual bool StopOfferService() = 0;

    virtual void RegisterReceiveHandler(NetworkBindingReceiveHandler handler) = 0;
    virtual bool send(MessagePtr msg) = 0;
    
public:
    virtual DeserializerPtr GetDeserializer(uint8_t* data, uint32_t size) = 0;
    virtual SerializerPtr GetSerializer() = 0;
    virtual MessagePtr MakeMessage(MessageType type) = 0;
};



} /** namespace runtime */
} /** namespace com */
} /** namespace ara */

#endif /** !__ARA_COM_RUNTIME_NETWORK_BINDING_SKELETON_H__ */

